package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.eduservice.service.EduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;

/**
 * <p>
 * 登录 前端控制器
 * </p>
 *
 * @author fly
 * @since 2021-09-12
 */
@Api(description = "登录模块")
@RestController
@RequestMapping("/eduservice/user")
public class EduLoginController {

    @Autowired
    private EduTeacherService eduTeacherService;

    @ApiOperation("登录")
    @PostMapping("/login")
    public R login() {
        return R.ok().data("token", "admin-token");
    }

    @ApiOperation("用户信息")
    @GetMapping("/info")
    public R info(String token) {
        return R.ok().data("name", "fly")
                .data("introduction", "heroes never die")
                .data("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif")
                .data("role", Collections.singletonList("admin"));
    }

    @ApiOperation(value = "登出")
    @PostMapping("/logout")
    public R logout() {
        return R.ok();
    }
}

